package object4.package6;
//Comparator和comparable不太一样
//Comparable需要把被比较的类,来实现这个接口
//而Comparator则是创建单独的类,来实现Comparator接口
public class Student2 {
    private int id;

    private String name;

    private double score;

    public Student2(int id,String name,double score){
        this.id = id;
        this.name = name;
        this.score = score;
    }

    public int getId() {
        return id;
    }

    public double getScore() {
        return score;
    }

    public static void main(String[] args) {
        Student2 s1 = new Student2(1,"zhangsan",100);
        Student2 s2 = new Student2(2,"lisi",99);

        StudentComparator comparator = new StudentComparator();
        System.out.println(comparator.compare(s1,s2));
    }
}
